package com.ai.wxy.spring.user.service;

import com.ai.wxy.spring.service.api.BaseService;
import com.ai.wxy.spring.service.api.dto.DefaultServiceParam;
import com.ai.wxy.spring.service.api.dto.ServiceConf;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 服务配置接口MOCK
 *
 * @author 石头
 * @Date 2019/11/18
 * @Version 1.0
 **/
@Service("servicesConfig")
public class TestServicesConfService implements BaseService {
    private static final Map<String,ServiceConf> allServiceConfs = new HashMap<>(16);
    static {
        ServiceConf conf1 = new ServiceConf();
        conf1.setRequestId("10001");
        conf1.setServiceId("testService");
        conf1.setServiceMethod("findUserByName");
        conf1.setScope("PATH");
        conf1.setParamName("queryId");
        conf1.setParamType("java.lang.String");
        conf1.setDesc("按名称查询用户信息");
        allServiceConfs.put("10001",conf1);

        ServiceConf conf2 = new ServiceConf();
        conf2.setRequestId("10002");
        conf2.setServiceId("testService");
        conf2.setServiceMethod("findUsers");
        conf2.setScope("REQ_BODY");
        conf2.setParamType("com.ai.wxy.spring.user.vo.UserQueryVo");
        conf2.setDesc("按条件查询用户信息");
        allServiceConfs.put("10002",conf2);

        ServiceConf conf3 = new ServiceConf();
        conf3.setRequestId("10003");
        conf3.setServiceId("testService");
        conf3.setServiceMethod("findUsers");
        conf3.setScope("REQ_PARAM");
        conf3.setParamType("com.ai.wxy.spring.user.vo.UserQueryVo");
        conf3.setDesc("按条件查询用户信息");
        allServiceConfs.put("10003",conf3);
    }

    public ServiceConf getServiceConfByReqId(DefaultServiceParam<String> param){
        return allServiceConfs.get(param.getParam());
    }
}
